function backDeviceGroup() {
	window.location.href = 'userRoleAdd.jsp';
}

function editDeviceGroup() {
	var ge = 0;
	var a = 1 + 3;
	for(var i = 0; i < a; i++) {
		var ticka = "tick_" + i
		var tickBlock = document.getElementById(ticka);
		if(tickBlock.style.display == "block") {
			ge = ge + 1;
		} else if(tickBlock.style.display == "" || tickBlock.style.display == "none") {}
	}
	if(ge == 1) {
		window.location.href = 'userRoleAdd.jsp';

	} else if(ge == 0) {
		alert("请选择")
	} else {
		alert("太多了！")
	}
}
//			全体打钩
function checkInput() {
	var tick = $(".tick").css("display");
	if(tick == "none") {
		$(".tick").show();
		console.log("?")
	} else if(tick == "block") {
		$(".tick").hide();
		$(".tick").hide();
		$(".tick_block ").hide();
	}
}
//			单独打钩
function checkInputA(data) {
	var ticka = "tick_" + data.id
	var tickBlock = document.getElementById(ticka);
	if(tickBlock.style.display == "block") {
		tickBlock.style.display = "none";
	} else if(tickBlock.style.display == "" || tickBlock.style.display == "none") {
		tickBlock.style.display = "block";
		sessionStorage.setItem("tick", ticka);
	}
}

$.ajax({
	url: 'roleList',
	type: 'POST',
	data: {
		session: $.Cookie("session"),
		userId: $.Cookie("userId")
	},
	dataType: 'json',
	success: function(data) {
		if(data.errorCode == 0) {
			$.each(data.result, function(i, value) {
				var nDate = new Date(value.createdTime); //直接将毫秒数当参数传进去。
				var month = nDate.getMonth() + 1;
				var year = nDate.getFullYear() + '-' + month + '-' + nDate.getDate() + " " + nDate.getHours() + ':' + nDate.getMinutes() + ':' + nDate.getSeconds();
				if(i % 2 == 0) {
					//					<div onclick="checkInputA(this)" class="content_input_b" id="' + value.id + '"><div id="tick_' + value.id + '" class="tick">√</div></div>
					var error_tpl = '<div class="userRole_content_contenta tick_' + value.id + '"><div class="userRole_content_header_one userRole_div">' + value.id + '</div><div class="userRole_content_header_div userRole_div">' + value.roleName + '</div><div class="userRole_content_header_div userRole_div">' + value.description + '</div><div class="userRole_content_header_div ">' + year + '</div><div class="userRole_content_header_div userRole_last_div">' + value.createdBy + '</div></div>'
				} else {
					var error_tpl = '<div class="userRole_content_content tick_' + value.id + '"><div class="userRole_content_header_one userRole_div">' + value.id + '</div><div class="userRole_content_header_div userRole_div">' + value.roleName + '</div><div class="userRole_content_header_div userRole_div">' + value.description + '</div><div class="userRole_content_header_div ">' + year + '</div><div class="userRole_content_header_div userRole_last_div">' + value.createdBy + '</div></div>'
				}
				$("#pageTool").append(error_tpl)
			});

		} else if(data.errorCode == -6) {
			alert("登录超时！")
			top.location.href = 'index.jsp';

		}
	},
	error: function(err) {
		alert("连接服务器失败！请重新提交！");
		top.location.href = 'index.jsp';
	}
});